package com.tentact.servlets;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.tentact.service.DeptService;
import com.tentact.vo.Dept;

import sun.print.resources.serviceui;

/**
 * Servlet implementation class SelectDeptByDnameServlet
 */
@WebServlet("/SelectDeptByDnameServlet")
public class SelectDeptByDnameServlet extends HttpServlet {
	DeptService service=new DeptService();
	private static final long serialVersionUID = 1L;
       
    /**
	 */
    public SelectDeptByDnameServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String dname=request.getParameter("dname");
		List<Dept>depts=service.selectByDname(dname);
		request.setAttribute("depts", depts);
		request.getRequestDispatcher("ViewDept.jsp").forward(request, response);
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
